#ifndef SRC_BASE_EVENT_LOOP_H_
#define SRC_BASE_EVENT_LOOP_H_

#include "base/common.h"
#include "noncopyable.hpp"
#include "event2/event.h"

class EventLoop : public noncopyable,
  public std::enable_shared_from_this<EventLoop> {
 public:
  typedef std::shared_ptr<EventLoop> Ptr;
  EventLoop();
  virtual ~EventLoop();

 public:
  bool Initialize();
  void Run();
  void Stop();
  void Uninitialize();

  void SetEventBase(event_base *event_base) {
    event_base_ = event_base;
  }
  struct event_base* GetEventBase() const {
    return event_base_;
  }

 private:
  struct event_base *event_base_;
};

#endif  // SRC_BASE_EVENT_LOOP_H_
